<?  include("user_check.php") ; ?>
<img src="images/ttfjpg.php?t=<? echo PAY_PAYPAL;?>&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  /><br /><img src="./module/paypalapi/scr_cclogos.gif" />
<?
if(!is_file('module/paypalapi/config.txt')){
	echo '<? echo PAY_PAYPAL_UNAVAILABLE; ?><br />';
	}else{
		$fp= fopen('module/paypalapi/config.txt', "r");
		$contents = fread($fp, 1024);
		$v_arr=explode('::',$contents);
		fclose($fp);
		}

if(!isset($_GET[ready])){
?><br />
<? echo PAY_PAYPAL_RECHARGE;?><br>
<? if($v_arr[2]>0){?>
(<? echo PAY_PAYPAL_FEE;?> : <? echo $v_arr[2];?>)<br>
<? }?>
<form action="?ready" name="myform" method="POST" onSubmit="return myfun()">
<input type="text" name="amount"  maxlength=20 onkeyup="if(value.match(/^\d{20}$/))value=value.replace(value,parseInt(value/10)) ;value=value.replace(/\.\d*\./g,'.')" onKeyPress="if((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 && event.keyCode!=45 || value.match(/^\d{20}$/) || /\.\d{2}$/.test(value)) {event.returnValue=false}" ><? echo parameters(4); ?><br><input type="submit" value="<? echo PROFILE_SUBMIT;?>" name="submit" >
</form>
<img src="images/paypal.jpg" width="114"/>
<?
}else{
$db->INSERT("INSERT INTO `".tablepre."paypal` (`custom`,`item_name`,`datetime`) VALUES ('".$checkmember[0][2]."','".$checkmember[0][0]."','".datetime."')");
$lastid = $db->select("SELECT pid FROM `".tablepre."paypal` order by pid desc limit 1");
?>

<form action="https://www.paypal.com/cgi-bin/webscr"  method="POST" target="_blank" >
<input type="hidden" name="cmd" value="_xclick">  
<input type="hidden" name="business" value="<? echo $v_arr[0];?>"> 
<input type="hidden" name="item_number" value="<? echo $lastid[0][0];?>"> 
<input type="hidden" name="item_name" value="<? echo $checkmember[0][0]; ?>"> 
<input type="hidden" name="custom" value="<? echo $checkmember[0][2]; ?>"> 
<input type="hidden" name="currency_code" value="<? echo $v_arr[1];?>">  
<input type="hidden" name="mc_fee" value="<? echo $v_arr[2];?>">  
<input type="hidden" name="notify_url" value="<? echo parameters(7);?>/module/paypalapi/paypal.php?notify_url">
<input type="hidden" name="return" value="<? echo parameters(7);?>/module/paypalapi/paypal.php?return">
<input type="hidden" name="cancel_return" value="<? echo parameters(7);?>/module/paypalapi/paypal.php?cancel_return">
<input type="hidden" name="amount" value="<? echo $_POST[amount];?>" >
<font size="+2"><? echo unit($_POST[amount]);?></font><br />
<input type="submit" value="<? echo PAY_PAYPAL_GO_TO_PAYPAL;?>" name="submit" class="menu"></form>
<img src="images/paypal.jpg" width="114"/>

<?
}
?>